package cn.wanho.service.impl;

import cn.wanho.dao.CmsUserGroupMapper;
import cn.wanho.dto.CmsUserGroup;
import cn.wanho.rvo.ResultEnum;
import cn.wanho.rvo.ResultVO;
import cn.wanho.service.CmsUserGroupService;
import cn.wanho.service.CmsUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service
public class CmsUserGroupServiceImpl implements CmsUserGroupService {

    @Resource
    private CmsUserGroupMapper cmsUserGroupMapper;

    /**
     * 添加用户权限绑定
     * @param cmsUserGroup
     * @return
     */
    @Override
    public ResultVO addUserGroup(CmsUserGroup cmsUserGroup) {

        int i = cmsUserGroupMapper.insert(cmsUserGroup);
        if (i!=0) {
            return ResultVO.success(ResultEnum.AUTHORITY_SET_SUCCESS.getResCode(), ResultEnum.AUTHORITY_SET_SUCCESS.getResMsg());
        }else{
            return ResultVO.failure(ResultEnum.AUTHORITY_SET_FAILURE.getResCode(), ResultEnum.AUTHORITY_SET_FAILURE.getResMsg());

        }
    }
}
